﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Data;

using H2.NET.Business;
using H2.NET.Controls;

namespace H2.NET.Web.Pages
{
    public partial class UsersChoose : TaskControl
    {
        #region 属性 Public
        private bool IsLoaded
        {
            get
            {
                return ViewState["IsLoaded"] == null ? false : (bool)ViewState["IsLoaded"];
            }
            set { ViewState["IsLoaded"] = value; }
        }

        private bool IsUsed
        {
            get
            {
                return ViewState["IsUsed"] == null ? false : (bool)ViewState["IsUsed"];
            }
            set { ViewState["IsUsed"] = value; }
        }

        public bool isReturned
        {
            get
            {
                return ViewState["isReturned"] == null ? false : (bool)ViewState["isReturned"];
            }
            set { ViewState["isReturned"] = value; }
        }

        public string MDCActions
        {
            get
            {
                return ViewState["MDCActions"] == null ? "" : (string)ViewState["MDCActions"]; ;
            }
            set { ViewState["MDCActions"] = value; }
        }

        #endregion

        #region 事件 页面加载
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
 
            //如果当前部门不需要显示，退出
            if (IsLoaded && !IsUsed)
            {
                this.Visible = false;
                return;
            }
            if (!Page.IsPostBack)
            {
                //string Prestep = ((object[])TaskAPI["PreStep"])[0].ToString();
                if (TaskAPI.Process == "ICD Customer")
                {
                    isReturned = (Parent.Page as SPM.IcdCustomerMaster).Assessment1.GetReturnStatus();
                }
                else if (TaskAPI.Process == "Global Vendor Master")
                {
                    isReturned = (Parent.Page as PGNVD).Assessment1.GetReturnStatus();
                }
                else if (TaskAPI.Process == "Old-New Formula Change")
                {
                    isReturned = (Parent.Page as SPM.Old_New_Formula).Assessment1.GetReturnStatus();
                }
                else if (TaskAPI.Process == "Authority To Recruit")
                {
                    //isReturned = (Parent.Page as PATR).Assessment1.GetReturnStatus();
                }
                else if (TaskAPI.Process == "Budget")
                {
                    isReturned = (Parent.Page as PBGD).Assessment1.GetReturnStatus();
                }
               
                else
                {
                    isReturned = (Parent.Page as PMDC).Assessment1.GetReturnStatus();
                }
                SetVisible(false, USR_Marketing_Add_Data_L, USR_Marketing_Add_Data_C, USR_Marketing_Add_Data);
                SetVisible(false, USR_Purchasing_Add_Data_L, USR_Purchasing_Add_Data_C, USR_Purchasing_Add_Data);
                SetVisible(false, USR_Logistic_Add_Data_L, USR_Logistic_Add_Data_C, USR_Logistic_Add_Data);
                SetVisible(false, USR_Finance_Run_Cost_L, USR_Finance_Run_Cost_C, USR_Finance_Run_Cost);
                SetVisible(false, USR_Production_PV_L, USR_Production_PV_C, USR_Production_PV);
                SetVisible(false, USR_Run_ICD_Price_L, USR_Run_ICD_Price_C, USR_Run_ICD_Price);

                //zph 添加P-Plant流程 
                SetVisible(false, USR_Run_ICD_Price_L2, USR_Run_ICD_Price_C2, USR_Run_ICD_Price2);

                SetVisible(false, USR_DMO_Run_SM35_L, USR_DMO_Run_SM35_C, USR_DMO_Run_SM35);
                SetVisible(false, USR_LF_Finance_Run_Cost_L, USR_LF_Finance_Run_Cost_C, USR_LF_Finance_Run_Cost);
                SetVisible(false, USR_LAM_Run_Price_L, USR_LAM_Run_Price_C, USR_LAM_Run_Price);
                SetVisible(false, USR_Finance_Run_Cost_L2, USR_Finance_Run_Cost_C2, USR_Finance_Run_Cost2);
                SetVisible(false, USR_Production_PV_L2, USR_Production_PV_C2, USR_Production_PV2);
                SetVisible(false, USR_Finance_Run_Cost_L3, USR_Finance_Run_Cost_C3, USR_Finance_Run_Cost3);
                SetVisible(false, USR_Production_PV_L3, USR_Production_PV_C3, USR_Production_PV3);
                SetVisible(false, USR_Finance_Run_Cost_L4, USR_Finance_Run_Cost_C4, USR_Finance_Run_Cost4);
                SetVisible(false, USR_Production_PV_L4, USR_Production_PV_C4, USR_Production_PV4);
                SetVisible(false, USR_Technical_Confirm_L, USR_Technical_Confirm_C, USR_Technical_Confirm);
                SetVisible(false, USR_Technical_Bom_L, USR_Technical_Bom_C, USR_Technical_Bom);
                SetVisible(false, USR_Confirm_Pack_Version_L, USR_Confirm_Pack_Version_C, USR_Confirm_Pack_Version);

                //zph 添加fomula change流程 
                SetVisible(false, USR_Production_PV_OEM_L, USR_Production_PV_OEM_C, USR_Production_PV_OEM);
                SetVisible(false, USR_Production_PV_SH_L, USR_Production_PV_SH_C, USR_Production_PV_SH);
                SetVisible(false, USR_Production_PV_GZ_L, USR_Production_PV_GZ_C, USR_Production_PV_GZ);
                SetVisible(false, USR_Production_PV_LF_L, USR_Production_PV_LF_C, USR_Production_PV_LF);
                SetVisible(false, USR_Finance_Run_Cost_LF_L, USR_Finance_Run_Cost_LF_C, USR_Finance_Run_Cost_LF);
                SetVisible(false, USR_Finance_Run_Cost_SH_L, USR_Finance_Run_Cost_SH_C, USR_Finance_Run_Cost_SH);
                SetVisible(false, USR_Finance_Run_Cost_GZ_L, USR_Finance_Run_Cost_GZ_C, USR_Finance_Run_Cost_GZ);




                //魏军 添加icdcustomer流程 的lam步骤 finance步骤 
                SetVisible(false, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM_C, USR_ICDCustomer_LAM);
                SetVisible(false, USR_ICDCustomer_Finance_L, USR_ICDCustomer_Finance_C, USR_ICDCustomer_Finance);
                //魏军 添加Old New Formula Change流程 的 LAM_List_Provide步骤 
                SetVisible(false, USR_LAM_List_Provide_L, USR_LAM_List_Provide_C, USR_LAM_List_Provide);
                //魏军 添加HK NPL Master Appliaction流程 的 Technical Confirm  步骤 
                SetVisible(false, USR_Technical_Confirm_HK_L, USR_Technical_Confirm_HK_C, USR_Technical_Confirm_HK);
                //魏军 添加HK NPL Master Appliaction流程 的 Technical BOM Confirm  步骤 
                SetVisible(false, USR_Technical_BOM_Confirm_L, USR_Technical_BOM_Confirm_C, USR_Technical_BOM_Confirm);

                //魏军 添加HK Sefi BOM-Ip 流程  的  Tech confirm and create PV 步骤 
                SetVisible(false,USR_Production_PV_L5, USR_Production_PV5, USR_Production_PV_C5);
                //魏军 添加HK Sefi BOM-Ip 流程  的  Technical Confirm RMC 步骤 
                SetVisible(false, USR_Finance_Test_Run_L, USR_Finance_Test_Run, USR_Finance_Test_Run_C);

                //zph 添加hr流程 的approver步骤 final approve步骤
                SetVisible(false, USR_Approver_L, USR_Approver, USR_Approver_C);
                SetVisible(false, USR_Final_Approver_L, USR_Final_Approver, USR_Final_Approver_C);
                SetVisible(false, USR_3rd_Approver_L, USR_3rd_Approver, USR_3rd_Approver_C);
                SetVisible(false, USR_4th_Approver_L, USR_4th_Approver, USR_4th_Approver_C);
                SetVisible(false, USR_5th_Approver_L, USR_5th_Approver, USR_5th_Approver_C);
                SetVisible(false, USR_6th_Approver_L, USR_6th_Approver, USR_6th_Approver_C);
                SetVisible(false, USR_7th_Approver_L, USR_7th_Approver, USR_7th_Approver_C);
                SetVisible(false, USR_Inform_Recruiter_L, USR_Inform_Recruiter, USR_Inform_Recruiter_C);

                //TB 添加TW Application-DECO步骤 HK Finance
                SetVisible(false, USR_HK_Finance_L, USR_HK_Finance, USR_HK_Finance_C);
                //TB添加NPL Master Data Application Technical
                SetVisible(false,USR_Technical_L,USR_Technical,USR_Technical_C);
                //TB 添加MTO Planning
                SetVisible(false, USR_Planning_L, USR_Planning, USR_Planning_C);


                IsUsed = false;
                if (!isReturned)
                {
                    IList<t_UserChoose> tUCs = (t_UserChoose.process == TaskAPI.Process & t_UserChoose.step == TaskAPI.Step).List<t_UserChoose>();
                    foreach (t_UserChoose tUC in tUCs)
                    {
                        if (((object[])TaskAPI["AR_Marketing_Add_Data"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Marketing_Add_Data").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Marketing_Add_Data_L, USR_Marketing_Add_Data_C, USR_Marketing_Add_Data); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Purchasing_Add_Data"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Purchasing_Add_Data").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Purchasing_Add_Data_L, USR_Purchasing_Add_Data_C, USR_Purchasing_Add_Data); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Logistic_Add_Data"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Logistic_Add_Data").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Logistic_Add_Data_L, USR_Logistic_Add_Data_C, USR_Logistic_Add_Data); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Finance_Run_Cost"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_L, USR_Finance_Run_Cost_C, USR_Finance_Run_Cost); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Production_PV"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_L, USR_Production_PV_C, USR_Production_PV); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Run_ICD_Price"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Run_ICD_Price").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Run_ICD_Price_L, USR_Run_ICD_Price_C, USR_Run_ICD_Price); IsUsed = true; }
                        //zph 添加P-Plant流程
                        if (((object[])TaskAPI["Run_ICD_Price2"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Run_ICD_Price").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Run_ICD_Price_L2, USR_Run_ICD_Price_C2, USR_Run_ICD_Price2); IsUsed = true; }

                        if (((object[])TaskAPI["AR_DMO_Run_SM35"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("DMO_Run_SM35").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_DMO_Run_SM35_L, USR_DMO_Run_SM35_C, USR_DMO_Run_SM35); IsUsed = true; }
                        if (((object[])TaskAPI["AR_LF_Finance_Run_Cost"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("LF_Finance_Run_Cost").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_LF_Finance_Run_Cost_L, USR_LF_Finance_Run_Cost_C, USR_LF_Finance_Run_Cost); IsUsed = true; }
                        if (((object[])TaskAPI["AR_LAM_Run_Price"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("LAM_Run_Price").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_LAM_Run_Price_L, USR_LAM_Run_Price_C, USR_LAM_Run_Price); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Finance_Run_Cost2"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost2").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_L2, USR_Finance_Run_Cost_C2, USR_Finance_Run_Cost2); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Production_PV2"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV2").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_L2, USR_Production_PV_C2, USR_Production_PV2); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Finance_Run_Cost3"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost3").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_L3, USR_Finance_Run_Cost_C3, USR_Finance_Run_Cost3); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Production_PV3"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV3").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_L3, USR_Production_PV_C3, USR_Production_PV3); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Finance_Run_Cost4"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost4").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_L4, USR_Finance_Run_Cost_C4, USR_Finance_Run_Cost4); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Production_PV4"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV4").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_L4, USR_Production_PV_C4, USR_Production_PV4); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Technical_Confirm"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Technical_Confirm").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Technical_Confirm_L, USR_Technical_Confirm_C, USR_Technical_Confirm); IsUsed = true; }
                        if (((object[])TaskAPI["AR_Technical_Bom"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Technical_Bom").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Technical_Bom_L, USR_Technical_Bom_C, USR_Technical_Bom); IsUsed = true; }

                        if (((object[])TaskAPI["AR_Confirm_Pack_Version"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Confirm_Pack_Version").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Confirm_Pack_Version_L, USR_Confirm_Pack_Version_C, USR_Confirm_Pack_Version); IsUsed = true; }
                        //魏军 添加icdcustomer流程 的lam步骤 finance步骤
                        if (((object[])TaskAPI["R_LAM"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("LAM").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM_C, USR_ICDCustomer_LAM); IsUsed = true; }
                        if (((object[])TaskAPI["R_Finance"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_ICDCustomer_Finance_L, USR_ICDCustomer_Finance_C, USR_ICDCustomer_Finance); IsUsed = true; }
                        //魏军 添加Old New Formula Change流程 的lam步骤 
                        if (((object[])TaskAPI["R_LAM_Provide_List"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("LAM_Provide_List").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_LAM_List_Provide_L, USR_LAM_List_Provide_C, USR_LAM_List_Provide); IsUsed = true; }
                        //魏军 添加HK NPL Master Appliaction流程 的 Technical Confirm 步骤
                        //if (TaskAPI.Process == "HK NPL Master Application")
                        //{
                        if (((object[])TaskAPI["R_Technical_Confirm"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Technical_Confirm_HK").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Technical_Confirm_HK_L, USR_Technical_Confirm_HK_C, USR_Technical_Confirm_HK); IsUsed = true; }
                        //}
                       //魏军 添加HK NPL Master Appliaction流程 的 Technical Confirm 步骤
                        if (((object[])TaskAPI["Technical_BOM_Confirm"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Technical_BOM_Confirm").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Technical_BOM_Confirm_L, USR_Technical_BOM_Confirm_C, USR_Technical_BOM_Confirm); IsUsed = true; }

                        ////魏军 添加HK Sefi BOM-Ip 流程  的  Tech confirm and create PV 步骤 
                        //if (((object[])TaskAPI["Production_PV"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV5").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_C5, USR_Production_PV5, USR_Production_PV_L5); IsUsed = true; }
                        ////魏军 添加HK Sefi BOM-Ip 流程  的  Technical Confirm RMC 步骤 
                        //if (((object[])TaskAPI["Finance_Test_Run"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Test_Run").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Test_Run, USR_Finance_Test_Run_L, USR_Finance_Test_Run_C); IsUsed = true; }

                        //zph 添加hr流程 的approver步骤 final approve步骤
                        if (((object[])TaskAPI["Approver"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Approver").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Approver_L, USR_Approver_C, USR_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Final_Approver"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Final_Approver").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Final_Approver_L, USR_Final_Approver_C, USR_Final_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Third_Manager"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Third_Manager").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_3rd_Approver_L, USR_3rd_Approver_C, USR_3rd_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Fouth_Manager"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Fouth_Manager").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_4th_Approver_L, USR_4th_Approver_C, USR_4th_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Fifth_Manager"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Fifth_Manager").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_5th_Approver_L, USR_5th_Approver_C, USR_5th_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Sixth_Manager"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Sixth_Manager").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_6th_Approver_L, USR_6th_Approver_C, USR_6th_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Seventh_Manager"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Seventh_Manager").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_7th_Approver_L, USR_7th_Approver_C, USR_7th_Approver); IsUsed = true; }
                        if (((object[])TaskAPI["Inform_Recruiter"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Inform_Recruiter").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Inform_Recruiter_L, USR_Inform_Recruiter_C, USR_Inform_Recruiter); IsUsed = true; }


                        //zph 添加fomula change流程
                        if (((object[])TaskAPI["Production_PV_OEM"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV_OEM").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_OEM_L, USR_Production_PV_OEM_C, USR_Production_PV_OEM); IsUsed = true; }
                        if (((object[])TaskAPI["Production_PV_SH"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV_SH").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_SH_L, USR_Production_PV_SH_C, USR_Production_PV_SH); IsUsed = true; }
                        if (((object[])TaskAPI["Production_PV_GZ"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV_GZ").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_GZ_L, USR_Production_PV_GZ_C, USR_Production_PV_GZ); IsUsed = true; }
                        if (((object[])TaskAPI["Production_PV_LF"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Production_PV_LF").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Production_PV_LF_L, USR_Production_PV_LF_C, USR_Production_PV_LF); IsUsed = true; }

                        if (((object[])TaskAPI["Finance_Run_Cost_LF"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost_LF").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_LF_L, USR_Finance_Run_Cost_LF_C, USR_Finance_Run_Cost_LF); IsUsed = true; }
                        if (((object[])TaskAPI["Finance_Run_Cost_SH"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost_SH").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_SH_L, USR_Finance_Run_Cost_SH_C, USR_Finance_Run_Cost_SH); IsUsed = true; }
                        if (((object[])TaskAPI["Finance_Run_Cost_GZ"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Finance_Run_Cost_GZ").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Finance_Run_Cost_GZ_L, USR_Finance_Run_Cost_GZ_C, USR_Finance_Run_Cost_GZ); IsUsed = true; }
                        
                        //TB 添加 TW Appcation-DECO步骤HK Finance
                        if(((object[])TaskAPI["HK_Finance"])[0].ToString()!="1"&&tUC.UserChoose.ToLower()==("HK_Finance").ToLower()&&(tUC.Actions.ToLower().Trim()==MDCActions.ToLower()||tUC.Actions.Trim()=="*")){SetVisible(true,USR_HK_Finance_L,USR_HK_Finance_C,USR_HK_Finance);IsUsed=true;}
                        //TB添加NPL Master Data Application Technical
                        if (((object[])TaskAPI["Technical"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Technical").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Technical_L, USR_Technical_C, USR_Technical); IsUsed = true; }
                        //TB添加MTO Planning
                        if (((object[])TaskAPI["Planning"])[0].ToString() != "1" && tUC.UserChoose.ToLower() == ("Planning").ToLower() && (tUC.Actions.ToLower().Trim() == MDCActions.ToLower() || tUC.Actions.Trim() == "*")) { SetVisible(true, USR_Planning_L, USR_Planning_C, USR_Planning); IsUsed = true; }

                    }
                }
                //this.IsUsed = USR_Finance_Run_Cost2.Visible || USR_Production_PV2.Visible || USR_Finance_Run_Cost3.Visible || USR_Production_PV3.Visible || USR_Finance_Run_Cost4.Visible || USR_Production_PV4.Visible
                //    || USR_Finance_Run_Cost.Visible || USR_Production_PV.Visible || USR_LAM_Run_Price.Visible || USR_Run_ICD_Price.Visible || USR_Marketing_Add_Data.Visible || USR_Purchasing_Add_Data.Visible || USR_Logistic_Add_Data.Visible;
                this.Visible = IsUsed;
                this.IsLoaded = true;

                SetEnable(TaskAPI.IsAllowSubmit, USR_Finance_Test_Run, USR_Production_PV, USR_LAM_Run_Price, USR_Run_ICD_Price, USR_DMO_Run_SM35, USR_LF_Finance_Run_Cost, USR_Finance_Run_Cost_C, USR_Production_PV_C, USR_LAM_Run_Price_C, USR_Run_ICD_Price_C, USR_DMO_Run_SM35_C, USR_LF_Finance_Run_Cost_C, USR_Marketing_Add_Data_C, USR_Purchasing_Add_Data_C, USR_Logistic_Add_Data_C
                    ,USR_Finance_Run_Cost2, USR_Production_PV2, USR_Finance_Run_Cost_C2, USR_Production_PV_C2, USR_Finance_Run_Cost3, USR_Production_PV3, USR_Finance_Run_Cost_C3, USR_Production_PV_C3, USR_Finance_Run_Cost4, USR_Production_PV4, USR_Finance_Run_Cost_C4, USR_Production_PV_C4
                    ,USR_Technical_BOM_Confirm_C, USR_Technical_BOM_Confirm, USR_Technical_Confirm_HK, USR_Technical_Confirm_HK_C, USR_Technical_Confirm, USR_Technical_Confirm_C, USR_Technical_Bom, USR_Technical_Bom_C, USR_ICDCustomer_Finance_C, USR_ICDCustomer_Finance, USR_ICDCustomer_LAM_C, USR_ICDCustomer_LAM, USR_LAM_List_Provide_C, USR_LAM_List_Provide,  USR_Approver, USR_Final_Approver_C, USR_Final_Approver,
                    USR_Confirm_Pack_Version, USR_Confirm_Pack_Version_C, USR_Production_PV5, USR_Finance_Test_Run, USR_Inform_Recruiter, USR_3rd_Approver_C, USR_3rd_Approver, USR_4th_Approver_C, USR_4th_Approver, USR_5th_Approver_C, USR_5th_Approver, USR_6th_Approver_C, USR_6th_Approver, USR_7th_Approver_C, USR_7th_Approver, USR_Production_PV_OEM_C, USR_Production_PV_OEM, USR_Production_PV_SH_C, USR_Production_PV_SH, USR_Production_PV_GZ_C, USR_Production_PV_GZ, USR_Production_PV_LF_C, USR_Production_PV_LF, USR_Finance_Run_Cost_LF_C, USR_Finance_Run_Cost_LF, USR_Finance_Run_Cost_SH_C, USR_Finance_Run_Cost_SH, USR_Finance_Run_Cost_GZ_C, USR_Finance_Run_Cost_GZ
                    , USR_HK_Finance, USR_HK_Finance_C, USR_Technical, USR_Run_ICD_Price2, USR_Run_ICD_Price_C2,USR_Planning,USR_Planning_C);

                SetForeColor(Color.Blue, USR_Confirm_Pack_Version_L,USR_Finance_Test_Run_L, USR_Production_PV_L5, USR_Finance_Run_Cost_L, USR_Production_PV_L, USR_Run_ICD_Price_L, USR_DMO_Run_SM35_L, USR_LF_Finance_Run_Cost_L, USR_LAM_Run_Price_L, USR_Marketing_Add_Data_L, USR_Purchasing_Add_Data_L, USR_Logistic_Add_Data_L
                    , USR_Finance_Run_Cost_L2, USR_Production_PV_L2, USR_Finance_Run_Cost_L3, USR_Production_PV_L3, USR_Finance_Run_Cost_L4, USR_Production_PV_L4
                    , USR_Technical_Confirm_HK_L, USR_Technical_Confirm_L, USR_Technical_Bom_L, USR_Approver_L, USR_Final_Approver_L, USR_Inform_Recruiter_L, USR_3rd_Approver_L, USR_4th_Approver_L, USR_5th_Approver_L, USR_6th_Approver_L, USR_7th_Approver_L, USR_Production_PV_OEM_L, USR_Production_PV_SH_L, USR_Production_PV_GZ_L, USR_Production_PV_LF_L, USR_Finance_Run_Cost_LF_L, USR_Finance_Run_Cost_SH_L, USR_Finance_Run_Cost_GZ_L
                    , USR_HK_Finance_L, USR_Technical_L, USR_Run_ICD_Price_L2, USR_Planning_L);

                USR_Confirm_Pack_Version_C.Checked = true;
                USR_Finance_Run_Cost_C.Checked = true;
                USR_Production_PV_C.Checked = true;
                USR_LAM_Run_Price_C.Checked = true;
                USR_Run_ICD_Price_C.Checked = true;
                //zph 添加P-Plant流程
                USR_Run_ICD_Price_C2.Checked = true;

                USR_DMO_Run_SM35_C.Checked = true;
                USR_LF_Finance_Run_Cost_C.Checked = true;
                USR_Marketing_Add_Data_C.Checked = true;
                USR_Purchasing_Add_Data_C.Checked = true;
                USR_Logistic_Add_Data_C.Checked = true;

                USR_Finance_Run_Cost_C2.Checked = true;
                USR_Production_PV_C2.Checked    = true;
                USR_Finance_Run_Cost_C3.Checked = true;
                USR_Production_PV_C3.Checked = true;
                USR_Finance_Run_Cost_C4.Checked = true;
                USR_Production_PV_C4.Checked = true;
                USR_Technical_Confirm_C.Checked = true;
                USR_Technical_Bom_C.Checked = true;
                USR_Technical_Confirm_HK_C.Checked = true;
                //魏军 添加icdcustomer流程 的lam步骤 finance步骤
                USR_ICDCustomer_LAM_C.Checked=true;
                USR_ICDCustomer_Finance_C.Checked = true;
                //魏军 添加Old New Formula Change流程 的lam步骤  
                USR_LAM_List_Provide_C.Checked = true;
                USR_Technical_BOM_Confirm_C.Checked = true;
                ////魏军 添加HK Sefi BOM-Ip 流程  的  Tech confirm and create PV 步骤 
                //USR_Finance_Test_Run_C.Checked = true;
                //USR_Production_PV_C5.Checked = true;

                //zph 添加hr流程 的approver步骤 final approve步骤
                USR_Approver_C.Checked = true;
                USR_Final_Approver_C.Checked = true;
                USR_3rd_Approver_C.Checked = true;
                USR_4th_Approver_C.Checked = true;
                USR_5th_Approver_C.Checked = true;
                USR_6th_Approver_C.Checked = true;
                USR_7th_Approver_C.Checked = true;
                USR_Inform_Recruiter_C.Checked = true;

                //zph 添加fomula change流程
                USR_Production_PV_OEM_C.Checked = true;
                USR_Production_PV_SH_C.Checked = true;
                USR_Production_PV_GZ_C.Checked = true;
                USR_Production_PV_LF_C.Checked = true;
                USR_Finance_Run_Cost_LF_C.Checked = true;
                USR_Finance_Run_Cost_SH_C.Checked = true;
                USR_Finance_Run_Cost_GZ_C.Checked = true;

                //TB 添加流程TW NPL Appcation-DECO步骤HK Finance
                USR_HK_Finance_C.Checked = true;
                //TB 添加NPL Master Data Application Technical
                USR_Technical_C.Checked = true;
                SetEnable(false, USR_Technical_C);
                //TB 添加流程MTO Planning步骤
                USR_Planning_C.Checked = true;

            }
        }
        #endregion

        #region 事件 用户选择
        protected void USR_TextChanged(object sender, EventArgs e)
        {
            if (!isReturned)
            {
                try
                {
                    string SQL = "select rtrim(NAME) as username, rtrim(FULLNAME) AS fullname from jobs where rtrim(name)='" + ((Dialog)sender).Text + "'";
                    TaskDB.Log("", true, "UserChoose - USR_TextChanged:" + SQL);

                    DBAPI.Storage("bpmDB");
                    DataTable dt = DBAPI.Query(SQL);

                    //根据查询结果进行赋值
                    if (dt.Rows.Count > 0)
                    {
                        ((Dialog)sender).Text = dt.Rows[0]["FULLNAME"].ToString();
                        switch (((Dialog)sender).ID)
                        {
                            case "USR_Finance_Run_Cost":
                                TaskAPI["Finance_Run_Cost"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Finance = dt.Rows[0]["username"].ToString());

                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_COST"] = "1"; } else { TaskAPI["_COST"] = "0"; TaskAPI["_COSTA"] = "0"; }
                                break;
                            case "USR_Production_PV":
                                TaskAPI["Production_PV"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_PV = dt.Rows[0]["username"].ToString());
                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_PV"] = "1"; } else { TaskAPI["_PV"] = "0"; TaskAPI["_PVA"] = "0"; }
                                break;
                            case "USR_LAM_Run_Price":
                                TaskAPI["LAM_Run_Price"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Run_ICD_Price":
                                TaskAPI["Run_ICD_Price"] = dt.Rows[0]["username"].ToString();
                                break;
                            //zph 添加P-Plant流程
                            case "USR_Run_ICD_Price2":
                                TaskAPI["Run_ICD_Price2"] = dt.Rows[0]["username"].ToString();
                                break;

                            case "USR_DMO_Run_SM35":
                                TaskAPI["DMO_Run_SM35"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_LF_Finance_Run_Cost":
                                TaskAPI["LF_Finance_Run_Cost"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Marketing_Add_Data":
                                TaskAPI["Marketing_Add_Data"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Marketing_Add_Data = dt.Rows[0]["username"].ToString());
                                break;
                            case "USR_Purchasing_Add_Data":
                                TaskAPI["Purchasing_Add_Data"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Purchasing_Add_Data = dt.Rows[0]["username"].ToString());
                                break;
                            case "USR_Logistic_Add_Data":
                                TaskAPI["Logistic_Add_Data"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Logistic_Add_Data = dt.Rows[0]["username"].ToString());
                                break;

                            case "USR_Finance_Run_Cost2":
                                TaskAPI["Finance_Run_Cost2"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Finance1 = dt.Rows[0]["username"].ToString());
                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_COST2"] = "1"; } else { TaskAPI["_COST2"] = "0"; TaskAPI["_COST2A"] = "0"; }
                                break;
                            case "USR_Production_PV2":
                                TaskAPI["Production_PV2"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_PV1 = dt.Rows[0]["username"].ToString());
                                
                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_PV2"] = "1"; } else { TaskAPI["_PV2"] = "0"; TaskAPI["_PV2A"] = "0"; }
                                break;
                            case "USR_Finance_Run_Cost3":
                                TaskAPI["Finance_Run_Cost3"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Finance2 = dt.Rows[0]["username"].ToString());
                                if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_COST3"] = "1"; } else { TaskAPI["_COST3"] = "0"; TaskAPI["_COST3A"] = "0"; }
                                break;
                            case "USR_Production_PV3": 
                                TaskAPI["Production_PV3"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_PV2 = dt.Rows[0]["username"].ToString());
                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_PV3"] = "1"; } else { TaskAPI["_PV3"] = "0"; TaskAPI["_PV3A"] = "0"; }
                                break;
                            case "USR_Finance_Run_Cost4":
                                TaskAPI["Finance_Run_Cost4"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Finance3 = dt.Rows[0]["username"].ToString());
                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_COST4"] = "1"; } else { TaskAPI["_COST4"] = "0"; TaskAPI["_COST4A"] = "0"; }
                                break;
                            case "USR_Production_PV4":
                                TaskAPI["Production_PV4"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_PV3 = dt.Rows[0]["username"].ToString());
                                //if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_PV4"] = "1"; } else { TaskAPI["_PV4"] = "0"; TaskAPI["_PV4A"] = "0"; }
                                break;
                            case "USR_Technical_Confirm":
                                TaskAPI["Technical_Confirm"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Technical_Confirm_HK":
                                TaskAPI["Technical_Confirm"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Technical_BOM_Confirm":
                                TaskAPI["Technical_BOM_Confirm"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Technical_Bom":
                                TaskAPI["Technical_Bom"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_ICDCustomer_LAM":
                                TaskAPI["LAM"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_ICDCustomer_Finance":
                                TaskAPI["Finance"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_LAM_List_Provide":
                                TaskAPI["R_LAM_Provide_List"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Production_PV5":
                                TaskAPI["Production_PV5"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Finance_Test_Run":
                                TaskAPI["Finance_Test_Run"] = dt.Rows[0]["username"].ToString();
                                break;

                            //zph 添加fomula change流程
                            case "USR_Production_PV_OEM":
                                TaskAPI["Production_PV_OEM"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Production_PV_SH":
                                TaskAPI["Production_PV_SH"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Production_PV_GZ":
                                TaskAPI["Production_PV_GZ"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Production_PV_LF":
                                TaskAPI["Production_PV_LF"] = dt.Rows[0]["username"].ToString();
                                break;

                            case "USR_Finance_Run_Cost_LF":
                                TaskAPI["Finance_Run_Cost_LF"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Finance_Run_Cost_SH":
                                TaskAPI["Finance_Run_Cost_SH"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Finance_Run_Cost_GZ":
                                TaskAPI["Finance_Run_Cost_GZ"] = dt.Rows[0]["username"].ToString();
                                break;



                            //zph 添加hr流程 的approver步骤 final approve步骤
                            case "USR_Approver":
                                TaskAPI["Approver"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Final_Approver":
                                TaskAPI["Final_Approver"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_3rd_Approver":
                                TaskAPI["Third_Manager"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_4th_Approver":
                                TaskAPI["Fouth_Manager"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_5th_Approver":
                                TaskAPI["Fifth_Manager"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_6th_Approver":
                                TaskAPI["Sixth_Manager"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_7th_Approver":
                                TaskAPI["Seventh_Manager"] = dt.Rows[0]["username"].ToString();
                                break;
                            case "USR_Confirm_Pack_Version":
                                TaskAPI["Confirm_Pack_Version"] = dt.Rows[0]["username"].ToString();
                                if (dt.Rows[0]["username"].ToString().Length > 0) { TaskAPI["_COST"] = "1"; } else { TaskAPI["_COST"] = "0"; TaskAPI["_COSTA"] = "0"; }
                                break;
                            case "USR_Inform_Recruiter":

                                string SQL_1 = " SELECT     TOP 1 RTRIM(EMAIL) AS EMAIL FROM  CLIENTS C WHERE      RTRIM(C.USERNAME) ='" + dt.Rows[0]["username"].ToString() + "'";

                                DBAPI.Storage("bpmDB");
                                DataTable dt_1 = DBAPI.Query(SQL_1);
                                TaskDB.Log("", true, "UserChoose - USR_TextChanged:" + SQL_1);

                                //根据查询结果进行赋值
                                if (dt_1.Rows.Count > 0)
                                {
                                    TaskAPI["Inform_Recruiter"] = dt_1.Rows[0]["EMAIL"].ToString();
                                    TaskAPI["R_Inform_Recruiter"] = dt.Rows[0]["username"].ToString();
                                   
                                }
 
                                break;
                            //TB 添加 TW Appcation-DECO步骤HK Finance
                            case"USR_HK_Finance":
                                TaskAPI["HK_Finance"] = dt.Rows[0]["username"].ToString();
                                break;
                            //TB 添加 NPL Master Data Application Technical
                            case "USR_Technical":
                                TaskAPI["Technical"] = dt.Rows[0]["username"].ToString();
                                break;
                            //TB 添加MTO Planning
                            case "USR_Planning":
                                TaskAPI["Planning"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.User_Planning = dt.Rows[0]["username"].ToString());
                                break;
                        }
                    }
                    else
                    {
                        ((Dialog)sender).Text = "";
                        switch (((Dialog)sender).ID)
                        {
                            //case "USR_Finance_Run_Cost":
                            //    TaskAPI["Finance_Run_Cost"] = "";
                            //    break;
                            //case "USR_Production_PV":
                            //    TaskAPI["Production_PV"] = "";
                            //    break;
                            case "USR_LAM_Run_Price":
                                TaskAPI["LAM_Run_Price"] = "";
                                break;
                            case "USR_Run_ICD_Price":
                                TaskAPI["Run_ICD_Price"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.Run_ICD_Price = dt.Rows[0]["username"].ToString());
                                break;
                            //zph 添加P-Plant流程
                            case "USR_Run_ICD_Price2":
                                 TaskAPI["Run_ICD_Price"] = dt.Rows[0]["username"].ToString();
                                (mdc_MDC.incident == Incident & mdc_MDC.process == Process).Edit<mdc_MDC>(p => p.Run_ICD_Price2 = dt.Rows[0]["username"].ToString());
                                break;

                            case "USR_DMO_Run_SM35":
                                TaskAPI["DMO_Run_SM35"] = "";
                                break;
                            case "USR_LF_Finance_Run_Cost":
                                TaskAPI["LF_Finance_Run_Cost"] = "";
                                break;
                            //case "USR_Marketing_Add_Data":
                            //    TaskAPI["Marketing_Add_Data"] = "";
                            //    break;
                            //case "USR_Purchasing_Add_Data":
                            //    TaskAPI["Purchasing_Add_Data"] = "";
                            //    break;
                            //case "USR_Logistic_Add_Data":
                            //    TaskAPI["Logistic_Add_Data"] = "";
                            //    break;

                            //case "USR_Finance_Run_Cost2":
                            //    TaskAPI["Finance_Run_Cost2"] = "";
                            //    break;
                            //case "USR_Production_PV2":
                            //    TaskAPI["Production_PV2"] = "";
                            //    break;
                            //case "USR_Finance_Run_Cost3":
                            //    TaskAPI["Finance_Run_Cost3"] = "";
                            //    break;
                            //case "USR_Production_PV3":
                            //    TaskAPI["Production_PV3"] = "";
                            //    break;
                            //case "USR_Finance_Run_Cost4":
                            //    TaskAPI["Finance_Run_Cost4"] = "";
                            //    break;
                            //case "USR_Production_PV4":
                            //    TaskAPI["Production_PV4"] = "";
                            //    break;
                            case "USR_Technical_Confirm":
                                TaskAPI["Technical_Confirm"] = "";
                                break;
                            case "USR_Technical_Confirm_HK":
                                TaskAPI["Technical_Confirm"] = "";
                                break;
                            case "USR_Technical_BOM_Confirm":
                                TaskAPI["Technical_BOM_Confirm"] = "";
                                break;
                            case "USR_Technical_Bom":
                                TaskAPI["Technical_Bom"] = "";
                                break;
                            case "USR_ICDCustomer_LAM":
                                TaskAPI["LAM"] = "";
                                break;
                            case "USR_ICDCustomer_Finance":
                                TaskAPI["Finance"] = "";
                                break;
                            case "USR_LAM_List_Provide":
                                TaskAPI["R_LAM_Provide_List"] = "";
                                break;
                            //case "USR_Production_PV5":
                            //    TaskAPI["Production_PV"] = "";
                            //    break;
                            case "USR_Finance_Test_Run":
                                TaskAPI["Finance_Test_Run"] = "";
                                break;
                            //zph 添加hr流程 的approver步骤 final approve步骤
                            case "USR_Approver":
                                TaskAPI["Approver"] = "";
                                break;
                            case "USR_Final_Approver":
                                TaskAPI["Final_Approver"] = "";
                                break;
                            case "USR_3rd_Approver":
                                TaskAPI["Third_Manager"] = "";
                                break;
                            case "USR_4th_Approver":
                                TaskAPI["Fouth_Manager"] = "";
                                break;
                            case "USR_5th_Approver":
                                TaskAPI["Fifth_Manager"] = "";
                                break;
                            case "USR_6th_Approver":
                                TaskAPI["Sixth_Manager"] = "";
                                break;
                            case "USR_7th_Approver":
                                TaskAPI["Seventh_Manager"] = "";
                                break;
                            case "USR_Inform_Recruiter":
                                TaskAPI["Inform_Recruiter"] = "";
                                break;
                            case "USR_Confirm_Pack_Version":
                                TaskAPI["Confirm_Pack_Version"] = "";
                                break;

                            //zph 添加fomula change流程
                            case "USR_Production_PV_OEM":
                                TaskAPI["Production_PV_OEM"] = "";
                                break;
                            case "USR_Production_PV_SH":
                                TaskAPI["Production_PV_SH"] = "";
                                break;
                            case "USR_Production_PV_GZ":
                                TaskAPI["Production_PV_GZ"] = "";
                                break;
                            case "USR_Production_PV_LF":
                                TaskAPI["Production_PV_LF"] = "";
                                break;

                            case "USR_Finance_Run_Cost_LF":
                                TaskAPI["Finance_Run_Cost_LF"] = "";
                                break;
                            case "USR_Finance_Run_Cost_SH":
                                TaskAPI["Finance_Run_Cost_SH"] = "";
                                break;
                            case "USR_Finance_Run_Cost_GZ":
                                TaskAPI["Finance_Run_Cost_GZ"] = "";
                                break;

                            //TB 添加 TW Appcation-DECO步骤HK Finance
                            case "USR_HK_Finance":
                                TaskAPI["HK_Finance"] = "";
                                break;
                            //TB 添加 NPL Master Data Application Technical
                            case "USR_Technical":
                                TaskAPI["Technical"] = "";
                                break;
                            //case "USR_Planning":
                            //    TaskAPI["Planning"] = "";
                            //    break;
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        #endregion

        #region 保存审批结果
        public void SaveStatus(string ApproveResult)
        {
            //if (TaskAPI.Step == "Production PV") { TaskAPI["_PVA"] = ApproveResult; }
            //if (TaskAPI.Step == "Finance Run Cost") { TaskAPI["_COSTA"] = ApproveResult; }
            //if (TaskAPI.Step == "Production PV2") { TaskAPI["_PV2A"] = ApproveResult; }
            //if (TaskAPI.Step == "Finance Run Cost2") { TaskAPI["_COST2A"] = ApproveResult; }
            //if (TaskAPI.Step == "Production PV3") { TaskAPI["_PV3A"] = ApproveResult; }
            //if (TaskAPI.Step == "Finance Run Cost3") { TaskAPI["_COST3A"] = ApproveResult; }
            //if (TaskAPI.Step == "Production PV4") { TaskAPI["_PV4A"] = ApproveResult; }
            //if (TaskAPI.Step == "Finance Run Cost4") { TaskAPI["_COST4A"] = ApproveResult; }
           
            //zph 添加 formula change流程
            if (TaskAPI.Step == "Production PV SH") { TaskAPI["_PVSHA"] = ApproveResult; }
            if (TaskAPI.Step == "Production PV GZ") { TaskAPI["_PVGZA"] = ApproveResult; }
            if (TaskAPI.Step == "Production PV LF") { TaskAPI["_PVLFA"] = ApproveResult; }
            if (TaskAPI.Step == "Production PV OEM") { TaskAPI["_PVOEMA"] = ApproveResult; }
            if (TaskAPI.Step == "Finance Run Cost SH") { TaskAPI["_CostSHA"] = ApproveResult; }
            if (TaskAPI.Step == "Finance Run Cost GZ") { TaskAPI["_CostGZA"] = ApproveResult; }
            if (TaskAPI.Step == "Finance Run Cost LF") { TaskAPI["_CostLFA"] = ApproveResult; }




        }
        #endregion

        #region 事件 USR_CheckBox 选择
        protected void USR_CheckBox_CheckedChanged(object sender, EventArgs e)
        {
            if (!isReturned)
            {
                switch (((Anthem.CheckBox)sender).ID)
                {
                    case "USR_Finance_Run_Cost_C":
                        SetForeColor(USR_Finance_Run_Cost_C.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_L);
                        TaskAPI["Finance_Run_Cost"] = "";USR_Finance_Run_Cost.Text = "";USR_Finance_Run_Cost.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Production_PV_C":
                        SetForeColor(USR_Production_PV_C.Checked ? Color.Blue : Color.Black, USR_Production_PV_L);
                        TaskAPI["Production_PV"] = "";USR_Production_PV.Text = "";USR_Production_PV.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Run_ICD_Price_C":
                        SetForeColor(USR_Run_ICD_Price_C.Checked ? Color.Blue : Color.Black, USR_Run_ICD_Price_L);
                        TaskAPI["Run_ICD_Price"] = "";USR_Run_ICD_Price.Text = "";USR_Run_ICD_Price.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    //zph 添加P-Plant流程
                    case "USR_Run_ICD_Price_C2":
                        SetForeColor(USR_Run_ICD_Price_C2.Checked ? Color.Blue : Color.Black, USR_Run_ICD_Price_L2);
                        TaskAPI["Run_ICD_Price2"] = ""; USR_Run_ICD_Price2.Text = ""; USR_Run_ICD_Price2.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_DMO_Run_SM35_C":
                    case "USR_LAM_Run_Price_C":
                    case "USR_LF_Finance_Run_Cost_C":
                        switch (((Anthem.CheckBox)sender).ID)
                        {
                            case "USR_DMO_Run_SM35_C": USR_LAM_Run_Price_C.Checked = USR_DMO_Run_SM35_C.Checked; USR_LF_Finance_Run_Cost_C.Checked = USR_DMO_Run_SM35_C.Checked; break;
                            case "USR_LAM_Run_Price_C": USR_DMO_Run_SM35_C.Checked = USR_LAM_Run_Price_C.Checked; USR_LF_Finance_Run_Cost_C.Checked = USR_LAM_Run_Price_C.Checked; break;
                            case "USR_LF_Finance_Run_Cost_C": USR_DMO_Run_SM35_C.Checked = USR_LF_Finance_Run_Cost_C.Checked; USR_LAM_Run_Price_C.Checked = USR_LF_Finance_Run_Cost_C.Checked; break;
                            case "USR_Run_ICD_Price_C": USR_DMO_Run_SM35_C.Checked = USR_Run_ICD_Price_C.Checked; USR_LF_Finance_Run_Cost_C.Checked = USR_Run_ICD_Price_C.Checked; break;
                        }
                        SetForeColor(USR_LAM_Run_Price_C.Checked ? Color.Blue : Color.Black, USR_LAM_Run_Price_L);
                        TaskAPI["LAM_Run_Price"] = ""; USR_LAM_Run_Price.Text = ""; USR_LAM_Run_Price.Enabled = ((Anthem.CheckBox)sender).Checked;
                        SetForeColor(USR_DMO_Run_SM35_C.Checked ? Color.Blue : Color.Black, USR_DMO_Run_SM35_L);
                        TaskAPI["DMO_Run_SM35"] = ""; USR_DMO_Run_SM35.Text = ""; USR_DMO_Run_SM35.Enabled = ((Anthem.CheckBox)sender).Checked;
                        SetForeColor(USR_LF_Finance_Run_Cost_C.Checked ? Color.Blue : Color.Black, USR_LF_Finance_Run_Cost_L);
                        TaskAPI["LF_Finance_Run_Cost"] = ""; USR_LF_Finance_Run_Cost.Text = ""; USR_LF_Finance_Run_Cost.Enabled = ((Anthem.CheckBox)sender).Checked;
                        //SetForeColor(USR_Run_ICD_Price_C.Checked ? Color.Blue : Color.Black, USR_Run_ICD_Price_L);
                        //TaskAPI["USR_Run_ICD_Price"] = ""; USR_Run_ICD_Price.Text = "";USR_Run_ICD_Price.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    //case "USR_LAM_Run_Price_C":
                    //    SetForeColor(USR_LAM_Run_Price_C.Checked ? Color.Blue : Color.Black, USR_LAM_Run_Price_L);
                    //    TaskAPI["LAM_Run_Price"] = "";
                    //    break;
                    //case "USR_DMO_Run_SM35_C":
                    //    SetForeColor(USR_DMO_Run_SM35_C.Checked ? Color.Blue : Color.Black, USR_DMO_Run_SM35_L);
                    //    TaskAPI["DMO_Run_SM35"] = "";
                    //    break;
                    //case "USR_LF_Finance_Run_Cost_C":
                    //    SetForeColor(USR_LF_Finance_Run_Cost_C.Checked ? Color.Blue : Color.Black, USR_LF_Finance_Run_Cost_L);
                    //    TaskAPI["LF_Finance_Run_Cost"] = "";
                    //    break;
                    case "USR_Marketing_Add_Data_C":
                        SetForeColor(USR_Marketing_Add_Data_C.Checked ? Color.Blue : Color.Black, USR_Marketing_Add_Data_L);
                        TaskAPI["Marketing_Add_Data"] = "";USR_Marketing_Add_Data.Text = "";USR_Marketing_Add_Data.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Purchasing_Add_Data_C":
                        SetForeColor(USR_Purchasing_Add_Data_C.Checked ? Color.Blue : Color.Black, USR_Purchasing_Add_Data_L);
                        TaskAPI["Purchasing_Add_Data"] = "";USR_Purchasing_Add_Data.Text = "";USR_Purchasing_Add_Data.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Logistic_Add_Data_C":
                        SetForeColor(USR_Logistic_Add_Data_C.Checked ? Color.Blue : Color.Black, USR_Logistic_Add_Data_L);
                        TaskAPI["Logistic_Add_Data"] = "";USR_Logistic_Add_Data.Text = "";USR_Logistic_Add_Data.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Finance_Run_Cost_C2":
                        SetForeColor(USR_Finance_Run_Cost_C2.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_L2);
                        TaskAPI["Finance_Run_Cost2"] = ""; USR_Finance_Run_Cost2.Text = ""; USR_Finance_Run_Cost2.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Production_PV_C2":
                        SetForeColor(USR_Production_PV_C2.Checked ? Color.Blue : Color.Black, USR_Production_PV_L2);
                        TaskAPI["Production_PV2"] = "";USR_Production_PV2.Text = ""; USR_Production_PV2.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Finance_Run_Cost_C3":
                        SetForeColor(USR_Finance_Run_Cost_C3.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_L3);
                        TaskAPI["Finance_Run_Cost3"] = "";USR_Finance_Run_Cost_C3.Text = ""; USR_Finance_Run_Cost3.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Production_PV_C3":
                        SetForeColor(USR_Production_PV_C3.Checked ? Color.Blue : Color.Black, USR_Production_PV_L3);
                        TaskAPI["Production_PV3"] = "";USR_Production_PV_C3.Text = ""; USR_Production_PV_C3.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Finance_Run_Cost_C4":
                        SetForeColor(USR_Finance_Run_Cost_C4.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_L4);
                        TaskAPI["Finance_Run_Cost4"] = "";USR_Finance_Run_Cost_C4.Text = ""; USR_Finance_Run_Cost_C4.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Production_PV_C4":
                        SetForeColor(USR_Production_PV_C4.Checked ? Color.Blue : Color.Black, USR_Production_PV_L4);
                        TaskAPI["Production_PV4"] = "";USR_Production_PV_C4.Text = ""; USR_Production_PV_C4.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Technical_Confirm_C":
                        SetForeColor(USR_Technical_Confirm_C.Checked ? Color.Blue : Color.Black, USR_Technical_Confirm_L);
                        TaskAPI["Technical_Confirm"] = "";
                        break;
                    case "USR_Technical_Confirm_HK_C":
                        SetForeColor(USR_Technical_Confirm_HK_C.Checked ? Color.Blue : Color.Black, USR_Technical_Confirm_HK_L);
                        TaskAPI["Technical_Confirm"] = "";
                        break;
                    case "USR_Technical_BOM_Confirm_C":
                        SetForeColor(USR_Technical_BOM_Confirm_C.Checked ? Color.Blue : Color.Black, USR_Technical_BOM_Confirm_L);
                        TaskAPI["Technical_BOM_Confirm"] = "";
                        break;
                    case "USR_Technical_Bom_C":
                        SetForeColor(USR_Technical_Bom_C.Checked ? Color.Blue : Color.Black, USR_Technical_Bom_L);
                        TaskAPI["Technical_Bom"] = "";
                        break;
                    case "USR_ICDCustomer_LAM_C":
                        SetForeColor(USR_ICDCustomer_LAM_C.Checked ? Color.Blue : Color.Black, USR_ICDCustomer_LAM_L);
                        TaskAPI["LAM"] = "";
                        break;
                    case "USR_ICDCustomer_Finance_C":
                        SetForeColor(USR_ICDCustomer_Finance_C.Checked ? Color.Blue : Color.Black, USR_ICDCustomer_Finance_L);
                        TaskAPI["Finance"] = "";
                        break;
                    case "USR_LAM_List_Provide_C":
                        SetForeColor(USR_LAM_List_Provide_C.Checked ? Color.Blue : Color.Black, USR_LAM_List_Provide_L);
                        TaskAPI["LAM_Provide_List"] = "";
                        break;
                    case "USR_Production_PV_C5":
                        SetForeColor(this.USR_Production_PV_C5.Checked ? Color.Blue : Color.Black, USR_Production_PV_L5);
                        TaskAPI["Production_PV"] = "";USR_Production_PV_C5.Text = ""; USR_Production_PV_C5.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Finance_Test_Run_C":
                        SetForeColor(this.USR_Finance_Test_Run_C.Checked ? Color.Blue : Color.Black, USR_Finance_Test_Run_L);
                        TaskAPI["Finance_Test_Run"] ="";
                        break;
                    //zph 添加hr流程 的approver步骤 final approve步骤
                    case "USR_Approver_C":
                        SetForeColor(USR_Approver_C.Checked ? Color.Blue : Color.Black, USR_Approver_L);
                        TaskAPI["Approver"] = "";
                        break;
                    case "USR_Final_Approver_C":
                        SetForeColor(USR_Final_Approver_C.Checked ? Color.Blue : Color.Black, USR_Final_Approver_L);
                        TaskAPI["Final_Approver"] = "";
                        break;
                    case "USR_3rd_Approver_C":
                        SetForeColor(USR_3rd_Approver_C.Checked ? Color.Blue : Color.Black, USR_3rd_Approver_L);
                        TaskAPI["Third_Manager"] = "";
                        break;
                    case "USR_4th_Approver_C":
                        SetForeColor(USR_4th_Approver_C.Checked ? Color.Blue : Color.Black, USR_4th_Approver_L);
                        TaskAPI["Fouth_Manager"] = "";
                        break;
                    case "USR_5th_Approver_C":
                        SetForeColor(USR_5th_Approver_C.Checked ? Color.Blue : Color.Black, USR_5th_Approver_L);
                        TaskAPI["Fifth_Manager"] = "";
                        break;
                    case "USR_6th_Approver_C":
                        SetForeColor(USR_6th_Approver_C.Checked ? Color.Blue : Color.Black, USR_6th_Approver_L);
                        TaskAPI["Sixth_Manager"] = "";
                        break;
                    case "USR_7th_Approver_C":
                        SetForeColor(USR_7th_Approver_C.Checked ? Color.Blue : Color.Black, USR_7th_Approver_L);
                        TaskAPI["Seventh_Manager"] = "";
                        break;
                    case "USR_Inform_Recruiter_C":
                        SetForeColor(USR_Inform_Recruiter_C.Checked ? Color.Blue : Color.Black, USR_Inform_Recruiter_L);
                        TaskAPI["Inform_Recruiter"] = "";
                        break;
                    case "USR_Confirm_Pack_Version_C":
                        SetForeColor(USR_Confirm_Pack_Version_C.Checked ? Color.Blue : Color.Black, USR_Confirm_Pack_Version_L);
                        TaskAPI["USR_Confirm_Pack_Version"] = "";
                        break;

                    //zph 添加fomula change流程
                    case "USR_Production_PV_OEM_C":
                        SetForeColor(USR_Production_PV_OEM_C.Checked ? Color.Blue : Color.Black, USR_Production_PV_OEM_L);
                        TaskAPI["Production_PV_OEM"] = ""; USR_Production_PV_OEM.Text = ""; USR_Production_PV_OEM.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Production_PV_SH_C":
                        SetForeColor(USR_Production_PV_SH_C.Checked ? Color.Blue : Color.Black, USR_Production_PV_SH_L);
                        TaskAPI["Production_PV_SH"] = ""; USR_Production_PV_SH.Text = ""; USR_Production_PV_SH.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Production_PV_GZ_C":
                        SetForeColor(USR_Production_PV_GZ_C.Checked ? Color.Blue : Color.Black, USR_Production_PV_GZ_L);
                        TaskAPI["Production_PV_GZ"] = ""; USR_Production_PV_GZ.Text = ""; USR_Production_PV_GZ.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Production_PV_LF_C":
                        SetForeColor(USR_Production_PV_LF_C.Checked ? Color.Blue : Color.Black, USR_Production_PV_LF_L);
                        TaskAPI["Production_PV_LF"] = ""; USR_Production_PV_LF.Text = ""; USR_Production_PV_LF.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;

                    case "USR_Finance_Run_Cost_LF_C":
                        SetForeColor(USR_Finance_Run_Cost_LF_C.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_LF_L);
                        TaskAPI["Finance_Run_Cost_LF"] = ""; USR_Finance_Run_Cost_LF.Text = ""; USR_Finance_Run_Cost_LF.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Finance_Run_Cost_SH_C":
                        SetForeColor(USR_Finance_Run_Cost_SH_C.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_SH_L);
                        TaskAPI["Finance_Run_Cost_SH"] = ""; USR_Finance_Run_Cost_SH.Text = ""; USR_Finance_Run_Cost_SH.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    case "USR_Finance_Run_Cost_GZ_C":
                        SetForeColor(USR_Finance_Run_Cost_GZ_C.Checked ? Color.Blue : Color.Black, USR_Finance_Run_Cost_GZ_L);
                        TaskAPI["Finance_Run_Cost_GZ"] = ""; USR_Finance_Run_Cost_GZ.Text = ""; USR_Finance_Run_Cost_GZ.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                    //TB 添加 TW Appcation-DECO步骤HK Finance
                    case "USR_HK_Finance_C":
                        SetForeColor(USR_HK_Finance_C.Checked? Color.Blue: Color.Black, USR_HK_Finance_L);
                        TaskAPI["HK_Finance"] = ""; USR_HK_Finance.Text=""; USR_HK_Finance.Enabled=((Anthem.CheckBox)sender).Checked;
                        break;
                    //TB 添加 NPL Master Data Application Technical
                    case "USR_Technical_C":
                        SetForeColor(USR_Technical_C.Checked?Color.Blue:Color.Black,USR_Technical_L);
                        TaskAPI["Technical"]="";USR_Technical.Text="";USR_Technical.Enabled=((Anthem.CheckBox)sender).Checked;
                        break;
                    //TB
                    case "USR_Planning_C":
                        SetForeColor(USR_Planning_C.Checked ? Color.Blue : Color.Black, USR_Planning_L);
                        TaskAPI["Planning"] = ""; USR_Planning.Text = ""; USR_Planning.Enabled = ((Anthem.CheckBox)sender).Checked;
                        break;
                }
            }
        }
        #endregion

        #region 方法 DataValidation(数据验证)
        public List<string> DataValidation()
        {
            //如果当前 Tabs 是隐藏的情况，退出
            if (!IsUsed)
            {
                return new List<string>();
            }
            
            List<string> vald_s = new List<string>();
            List<Regular> regs = new List<Regular>();

           
            
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Finance_Run_Cost_L, USR_Finance_Run_Cost.Text, "User: Finance Run Cost 必填");
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Production_PV_L, USR_Production_PV.Text, "User: Production PV 必填");
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Finance_Run_Cost_L2, USR_Finance_Run_Cost2.Text, "User: Finance Run Cost 2 必填");
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Production_PV_L2, USR_Production_PV2.Text, "User: Production PV 2 必填");
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Finance_Run_Cost_L3, USR_Finance_Run_Cost3.Text, "User: Finance Run Cost 3 必填");
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Production_PV_L3, USR_Production_PV3.Text, "User: Production PV 3 必填");
            //}
            //else if (TaskAPI.Process == "Formula Change Application")
            //{
                if (TaskAPI.Process == "Formula Change Application")
                {   
                 akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Production_PV_OEM_L, USR_Production_PV_OEM.Text, "User: Production PV OEM 必填");
                 if (USR_Production_PV_OEM.Text == "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV_SH.Text + USR_Production_PV_GZ.Text + USR_Production_PV_LF.Text, "User: PV中上海/广州/廊坊 必须与Finance配对选择"));
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost_SH.Text + USR_Finance_Run_Cost_GZ.Text + USR_Finance_Run_Cost_LF.Text, "User: Finance中上海/广州/廊坊 必须与PV配对选择"));

                    if (USR_Production_PV_SH.Text != "")
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost_SH.Text, "User:Finance Run Cost SH 必填"));
                    }
                    if (USR_Production_PV_GZ.Text != "")
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost_GZ.Text, "User:Finance Run Cost GZ 必填"));
                    }
                    if (USR_Production_PV_LF.Text != "")
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost_LF.Text, "User:Finance Run Cost LF 必填"));
                    }
                    if (USR_Finance_Run_Cost_SH.Text != "")
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV_SH.Text, "User:Production PV SH 必填"));
                    }
                    if (USR_Finance_Run_Cost_GZ.Text != "")
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV_GZ.Text, "User:Production PV GZ 必填"));
                    }
                    if (USR_Finance_Run_Cost_LF.Text != "")
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV_LF.Text, "User:Production PV LF 必填"));
                    }
                }
                else if (USR_Production_PV_OEM.Text != "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost_SH.Text + USR_Finance_Run_Cost_GZ.Text + USR_Finance_Run_Cost_LF.Text, "User: Finance中上海/广州/廊坊 必须选择其一"));
                }

            }
            if(TaskAPI.Process == "P-Plant Extend Application")
            {
                if (USR_Production_PV.Text!="")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost.Text, "User:Finance Run Cost 必填"));
                }
                if (USR_Production_PV2.Text != "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost2.Text, "User:Finance Run Cost2 必填"));
                }
                if (USR_Finance_Run_Cost.Text != "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV.Text, "Production PV 必填"));
                }
                if (USR_Finance_Run_Cost2.Text != "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV2.Text, "User:Production PV2 必填"));
                }
                if (USR_Run_ICD_Price.Text != "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV.Text, "Production PV 必填"));
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost.Text, "User:Finance Run Cost 必填"));
                }
                if (USR_Run_ICD_Price2.Text != "")
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV2.Text, "User:Production PV2 必填"));
                    regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Run_Cost2.Text, "User:Finance Run Cost2 必填"));
                }
               
            }
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_LAM_Run_Price_L, USR_LAM_Run_Price.Text, "User: LAM Run Price 必填");

            
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Run_ICD_Price_L, USR_Run_ICD_Price.Text, "User: Run ICD Price 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Run_ICD_Price_L2, USR_Run_ICD_Price2.Text, "User: Run ICD Price2 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_DMO_Run_SM35_L, USR_DMO_Run_SM35.Text, "User: DMO Run SM35 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_LF_Finance_Run_Cost_L, USR_LF_Finance_Run_Cost.Text, "User: LF Finance Run Cost 必填");
            
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Finance_Run_Cost_L4, USR_Finance_Run_Cost4.Text, "User: Finance Run Cost 4 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Production_PV_L4, USR_Production_PV4.Text, "User: Production PV 4 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Technical_Confirm_L, USR_Technical_Confirm.Text, "User: Technical_Confirm 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Technical_Bom_L, USR_Technical_Bom.Text, "User: Technical_Bom 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Marketing_Add_Data_L, USR_Marketing_Add_Data.Text, "User: Marketing_Add_Data 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Purchasing_Add_Data_L, USR_Purchasing_Add_Data.Text, "User: Purchasing_Add_Data 必填");
            akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Logistic_Add_Data_L, USR_Logistic_Add_Data.Text, "User: Logistic_Add_Data 必填");

                        
            if (USR_ICDCustomer_LAM_C.Checked && USR_ICDCustomer_LAM_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM.Text, "User: LAM  必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_ICDCustomer_LAM.Text.ToString().Trim(), "&nbsp;&nbsp;  LAM  必填"));

            }
            if (USR_ICDCustomer_Finance_C.Checked && USR_ICDCustomer_Finance_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_Finance_L, USR_ICDCustomer_Finance.Text, "User: Finance 必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_ICDCustomer_Finance.Text.ToString().Trim(), "&nbsp;&nbsp;  Finance  必填"));

            }
            if (USR_LAM_List_Provide_C.Checked && USR_LAM_List_Provide_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_LAM_List_Provide_L, USR_LAM_List_Provide.Text, "User: LAM_List_Provide 必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_LAM_List_Provide.Text.ToString().Trim(), "&nbsp;&nbsp; LAM List Provide  必填"));
            }
            if (USR_Technical_Confirm_HK_C.Checked && USR_Technical_Confirm_HK_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM.Text, "User: LAM  必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_Technical_Confirm_HK.Text.ToString().Trim(), "&nbsp;&nbsp;  Technical Confirm 必填"));

            }
            if (USR_Technical_BOM_Confirm_C.Checked && USR_Technical_BOM_Confirm_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM.Text, "User: LAM  必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_Technical_BOM_Confirm.Text.ToString().Trim(), "&nbsp;&nbsp;  Technical BOM Confirm 必填"));

            }
            if (this.USR_Finance_Test_Run_C.Checked && USR_Finance_Test_Run_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM.Text, "User: LAM  必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_Finance_Test_Run.Text.ToString().Trim(), "&nbsp;&nbsp;  Finance Test Run  必填"));

            }
            if (this.USR_Production_PV_C5.Checked && USR_Production_PV_C5.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM.Text, "User: LAM  必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_Production_PV5.Text.ToString().Trim(), "&nbsp;&nbsp;  Production PV 必填"));

            }
            if (this.USR_Confirm_Pack_Version_C.Checked && USR_Confirm_Pack_Version_C.Visible)
            {
                //akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_ICDCustomer_LAM_L, USR_ICDCustomer_LAM.Text, "User: LAM  必填");
                regs.Add(new Regular(RegularExp.NotEmpty, USR_Confirm_Pack_Version.Text.ToString().Trim(), "&nbsp;&nbsp;   Confirm Pack Version 必填"));

            }
            //zph 添加hr流程 的approver步骤 final approve步骤
            if (USR_7th_Approver_C.Checked && USR_7th_Approver_C.Visible)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, USR_7th_Approver.Text.ToString().Trim(), "7th Manager  必填"));

                if (string.IsNullOrEmpty(USR_6th_Approver.Text) || string.IsNullOrEmpty(USR_5th_Approver.Text) || string.IsNullOrEmpty(USR_4th_Approver.Text) || string.IsNullOrEmpty(USR_3rd_Approver.Text) || string.IsNullOrEmpty(USR_Final_Approver.Text))
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, "", "请选择 7th Approver之前的经理"));
                }
            }
            else if (USR_6th_Approver_C.Checked && USR_6th_Approver_C.Visible)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, USR_6th_Approver.Text.ToString().Trim(), "6th Manager  必填"));

                if (string.IsNullOrEmpty(USR_5th_Approver.Text) || string.IsNullOrEmpty(USR_4th_Approver.Text) || string.IsNullOrEmpty(USR_3rd_Approver.Text) || string.IsNullOrEmpty(USR_Final_Approver.Text))
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, "", "请选择 6th Approver之前的经理"));
                }
            }

            else if (USR_5th_Approver_C.Checked && USR_5th_Approver_C.Visible)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, USR_5th_Approver.Text.ToString().Trim(), "5th Manager  必填"));
              
                if (string.IsNullOrEmpty(USR_4th_Approver.Text) || string.IsNullOrEmpty(USR_3rd_Approver.Text) || string.IsNullOrEmpty(USR_Final_Approver.Text))
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, "", "请选择 5th Approver之前的经理"));
                }
            }
            else if (USR_4th_Approver_C.Checked && USR_4th_Approver_C.Visible)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, USR_4th_Approver.Text.ToString().Trim(), "4th Manager  必填"));
                
                if (string.IsNullOrEmpty(USR_3rd_Approver.Text) || string.IsNullOrEmpty(USR_Final_Approver.Text))
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, "", "请选择4th Approver之前的经理"));
                }
            }
            else if (USR_3rd_Approver_C.Checked && USR_3rd_Approver_C.Visible)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, USR_3rd_Approver.Text.ToString().Trim(), "3rd Manager  必填"));
               
                if (string.IsNullOrEmpty(USR_Final_Approver.Text) || string.IsNullOrEmpty(USR_Approver.Text))
                {
                    regs.Add(new Regular(RegularExp.NotEmpty, "", "请选择3rd Approver之前的经理"));
                }
            }
            else if (USR_Final_Approver_C.Checked && USR_Final_Approver_C.Visible)
            {
                regs.Add(new Regular(RegularExp.NotEmpty, USR_Final_Approver.Text.ToString().Trim(), "2nd Manager  必填"));
               
                    if (string.IsNullOrEmpty(USR_Approver.Text))
                    {
                        regs.Add(new Regular(RegularExp.NotEmpty, "", "1st Manager 必填"));
                    }
               
            }
            if (USR_Approver_C.Checked && USR_Approver_C.Visible && !string.IsNullOrEmpty(USR_Final_Approver.Text) && !string.IsNullOrEmpty(USR_3rd_Approver.Text) && !string.IsNullOrEmpty(USR_3rd_Approver.Text) && !string.IsNullOrEmpty(USR_4th_Approver.Text) && !string.IsNullOrEmpty(USR_5th_Approver.Text))
            {
                regs.Add(new Regular(RegularExp.NotEmpty,  USR_Approver.Text, "1st Manager 必填"));
            }

            if (USR_Inform_Recruiter_C.Checked && USR_Inform_Recruiter_C.Visible)
            {
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Inform_Recruiter_L, USR_Inform_Recruiter.Text, "Inform Recruiter 必填");
            }
            //TB 添加 TW Appcation-DECO步骤HK Finance
            if (USR_HK_Finance_C.Checked && USR_HK_Finance_C.Visible)
            {
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_HK_Finance_L, USR_HK_Finance.Text, "HK Finance 必填");
            }
            //TB 添加 NPL Master Data Application Technical
            if (USR_Technical_C.Checked && USR_Technical_C.Visible)
            {
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Technical_L, USR_Technical.Text, "Technical 必填");
            }
            //TB 添加MTO   Planning
            if (USR_Planning_C.Checked && USR_Planning_C.Visible)
            {
                akzo_RegularCheck(ref regs, RegularExp.NotEmpty, USR_Planning_L, USR_Planning.Text, "Planning 必填");
            }

            vald_s.AddRange(Validation(regs));

            if (vald_s.Count > 0)
            {
                vald_s.Insert(0, "<font color='#0000FF'><b>Users Choose</b></font>");
            }

            return vald_s;
        }
        #endregion

    }
}
